<?php

namespace App\Api\Http\Middleware;

use Closure;

class Apilogin {
    public function handle($request,Closure $next){
        $url=$_SERVER['REQUEST_URI'];
        $a=explode('?',$url);
        $r_login=session()->get('is_login');
        //登录过期
        if(empty($a[1])){
            $my_status=1000;//登录过期
            return redirect('/api/restart/abc/'.$my_status);
        }
        else{
            if($r_login==''){
                $my_status=400;//登录过期
                return redirect('/api/restart/abc/'.$my_status.'?'.$a[1]);
            }
            return $next($request);
        }
    }
}